#include "FNF_Vertex_Info.h"
#include <iostream>
#include "Log.h"

FNF_Vertex_Info::FNF_Vertex_Info(double x, double y, int color) {
    LOG_ENTER(GRAPH, "FNF_Vertex_Info::FNF_Vertex_Info");

    this->x = x;
    this->y = y;
    this->color = color;

    LOG_EXIT();
}

std::ostream& FNF_Vertex_Info::print(std::ostream& os) const {
    os << "[ " << x << " " << y << " " << color << " ]";
    return os;
}

bool FNF_Vertex_Info::match(Parser& parser) {
    LOG_ENTER(INPUT, "FNF_Vertex_Info::match");

    int m = 0;
    m += parser.match_char  ("[");
    m += parser.match_double(x);
    m += parser.match_double(y);
    m += parser.match_int(color);
    m += parser.match_char  ("]");

    if (m == 5) {

        LOG_EXIT();

        return true;
    }

    parser.backup(m);

    LOG_EXIT();

    return false;
}

std::ostream& operator<<( std::ostream& os,
                          const FNF_Vertex_Info& v ) {
    return v.print(os);
}
